Method for generating prediction block in amvp mode

ABSTRACT

A method for generating a prediction block in Advanced Motion Vector Prediction (AMVP) mode to reconstruct a prediction-coded video signal using a motion vector approximate to original motion information. An AMVP candidate list is generated using effective spatial and temporal AMVP candidates for a current Prediction Unit (PU). If the number of the effective AMVP candidates is smaller than a predetermined value, a motion vector having a predetermined value as a candidate to the AMVP candidate list. Then a motion vector corresponding to an AMVP index of the current PU from among motion vectors included in the AMVP candidate list is determined to be a motion vector predictor of the current PU.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a Continuation of co-pending application Ser. No.14/083,232 filed on Nov. 18, 2013, which is Continuation of applicationSer. No. 13/742,058 filed on Jan. 15, 2013, which is the national phaseof PCT International Application No. PCT/KR2012/000522 filed on Jan. 20,2012, and which claims priority to Application No. 10-2011-0086518 filedin the Republic of Korea on Aug. 29, 2011. The entire contents of all ofthe above applications are hereby incorporated by reference.

FIELD OF THE INVENTION

The present invention relates to a method for generating a predictionblock of an image that has been encoded in Advanced Motion VectorPrediction (AMVP) mode, and more particularly, to a method for decodingmotion information encoded in AMVP mode and generating a predictionblock based on the motion information.

DISCUSSION OF THE RELATED ART

Many techniques have been proposed to effectively compress a videosignal with a video quality maintained. Particularly, inter-predictioncoding is one of the most effective video compression techniques, inwhich a block similar to a current block is extracted from a previouspicture and the difference between the current block and the extractedblock is encoded.

However, motion information about each block should be additionallytransmitted in the inter-prediction coding scheme, with a coded residualblock. Therefore, effective coding of motion information that reducesthe amount of data is another video compression technique.

In motion estimation coding, a block best matching to a current block issearched in a predetermined search range of a reference picture using apredetermined evaluation function. Once the best matching block issearched in the reference picture, only the residue between the currentblock and the best matching block is transmitted, thereby increasing adata compression rate.

To decode the current block when coded through motion estimation,information about a motion vector representing a difference between aposition of the current block and that of the best matching block isneeded. Thus, the motion vector information is encoded and inserted intoa bit stream during coding. If the motion vector information is simplyencoded and inserted, overhead is increased, thereby decreasing thecompression rate of video data.

Accordingly, the motion vector of the current block is predicted usingneighboring blocks and only the difference between a motion vectorpredictor resulting from the prediction and the original motion vectoris encoded and transmitted, thereby compressing the motion vectorinformation in the inter-prediction coding scheme.

In H.264, the motion vector predictor of the current block is determinedto be a median value (mvA, mvB, mvC). Since the neighboring blocks arelikely to be similar to one another, the median value of the motionvectors of the neighboring blocks is determined to be the motion vectorof the current block.

However, if one or more of the motion vectors of the neighboring blocksare different from the motion vector of the current block, the medianvalue does not predict the motion vector of the current blockeffectively.

In addition, as prediction blocks are larger in size and diversified,the number of reference pictures is increased. Thus, the data amount ofa residual block is reduced but the amount of motion information to betransmitted (a motion vector and a reference picture index) isincreased.

Accordingly, there exists a need for a technique for more effectivelyreducing the amount of motion information to be transmitted. Inaddition, a technique for efficiently reconstructing motion informationencoded in the above technique is needed.

SUMMARY OF THE INVENTION

An object of the present invention devised to solve the problem lies ona method for generating a prediction block by effectively reconstructingmotion information encoded in AMVP mode.

The object of the present invention can be achieved by providing amethod for generating a prediction block in AMVP mode, includingreconstructing a reference picture index and a differential motionvector of a current Prediction Unit (PU), searching an effective spatialAMVP candidate for the current PU, searching an effective temporal AMVPcandidate for the current PU, generating an AMVP candidate list usingthe effective spatial and temporal AMVP candidates, adding a motionvector having a predetermined value as a candidate to the AMVP candidatelist, when the number of the effective AMVP candidates is smaller than apredetermined number, determining a motion vector corresponding to anAMVP index of the current PU from among motion vectors included in theAMVP candidate list to be a motion vector predictor of the current PU,reconstructing a motion vector of the current PU using the differentialmotion vector and the motion vector predictor, and generating aprediction block corresponding to a position indicated by thereconstructed motion vector within a reference picture indicated by thereference picture index.

In the method for generating a prediction block in AMVP mode accordingto the present invention, a reference picture index and a differentialmotion vector of a current prediction unit are reconstructed and an AMVPcandidate list is made using effective spatial and temporal AMVPcandidates of the current prediction unit. If the number of theeffective AMVP candidates is smaller than a predetermined number, amotion vector having a predetermined value is added to the AMVPcandidate list. Then, a motion vector corresponding to an AMVP index ofthe current prediction unit is selected as a motion vector predictor ofthe current prediction unit from among motion vectors included in theAMVP candidate list. A motion vector of the current prediction unit isreconstructed using the differential motion vector and the motion vectorpredictor and a prediction block corresponding to a position indicatedby the reconstructed motion vector in a reference picture indicated bythe reference picture index is generated.

Since motion information of the current prediction unit is predictedbetter using the spatial and temporal motion vector candidates, theamount of coded information is reduced. Furthermore, an accurateprediction block can be generated fast by decoding motion informationencoded in AMVP mode very effectively.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are included to provide a furtherunderstanding of the invention, illustrate embodiments of the inventionand together with the description serve to explain the principle of theinvention.

In the drawings:

FIG. 1 is a block diagram of a video encoder according to an embodimentof the present invention;

FIG. 2 is a flowchart illustrating an inter-prediction coding operationaccording to an embodiment of the present invention;

FIG. 3 is a flowchart illustrating a merge coding operation according toan embodiment of the present invention;

FIG. 4 illustrates the positions of merge candidates according to anembodiment of the present invention;

FIG. 5 illustrates the positions of merge candidates according toanother embodiment of the present invention;

FIG. 6 is a flowchart illustrating an AMVP coding operation according toan embodiment of the present invention;

FIG. 7 is a block diagram of a video decoder according to an embodimentof the present invention;

FIG. 8 is a flowchart illustrating an inter-prediction decodingoperation according to an embodiment of the present invention;

FIG. 9 is a flowchart illustrating a merge-mode motion vector decodingoperation according to an embodiment of the present invention;

FIG. 10 is a flowchart illustrating a merge-mode motion vector decodingoperation according to another embodiment of the present invention;

FIG. 11 is a flowchart illustrating an AMVP-mode motion vector decodingoperation according to an embodiment of the present invention; and

FIG. 12 is a flowchart illustrating an AMVP-mode motion vector decodingoperation according to another embodiment of the present invention.

DESCRIPTION OF THE EMBODIMENTS

FIG. 1 is a block diagram of a video encoder according to an embodimentof the present invention.

Referring to FIG. 1, a video encoder 100 according to the presentinvention includes a picture divider 110, a transformer 120, a quantizer130, a scanner 131, an entropy encoder 140, an intra-predictor 150, aninter-predictor 160, an inverse quantizer 135, an inverse transformer125, a post-processor 170, a picture storage 180, a subtractor 190, andan adder 195.

The picture divider 110 partitions every Largest Coding Unit (LCU) of apicture into CUs each having a predetermined size by analyzing an inputvideo signal, determines a prediction mode, and determines a size of aPrediction Unit (PU) for each CU. The picture divider 110 provides a PUto be encoded to the intra-predictor 150 or the inter-predictor 160according to a prediction mode (or prediction method).

The transformer 120 transforms a residual block which indicates aresidual signal between the original block of an input PU and aprediction block generated from the intra-predictor 150 or theinter-predictor 160. The residual block is composed of CU or PU. Theresidual block is divided into optimum transform units and thentransformed. A transform matrix may be differently determined based on aprediction mode (i.e. inter-prediction mode or intra-prediction mode).Because an intra-prediction residual signal includes directionalitycorresponding to the intra-prediction mode, a transform matrix may bedetermined for the intra-prediction residual signal adaptively accordingto the intra-prediction mode. Transform units may be transformed by two(horizontal and vertical) one-dimensional transform matrices. Forexample, a predetermined single transform matrix is determined forinter-prediction. On the other hand, in case of intra-prediction, if theintra-prediction mode is horizontal, the residual block is likely to bedirectional horizontally and thus a Discrete Cosine Transform(DCT)-based integer matrix and a Discrete Sine Transform (DST)-based orKarhunen-Loeve Transform (KLT)-based integer matrix are respectivelyapplied vertically and horizontally. If the intra-prediction mode isvertical, a DST-based or KLT-based integer matrix and a DCT-basedinteger matrix are respectively applied vertically and horizontally. InDC mode, a DCT-based integer matrix is applied in both directions. Inaddition, in case of intra-prediction, a transform matrix may bedetermined adaptively according to the size of a transform unit.

The quantizer 130 determines a quantization step size to quantize thecoefficients of the residual block transformed using the transformmatrix. The quantization step size is determined for each CU of apredetermined size or larger (hereinafter, referred to as a quantizationunit). The predetermined size may be 8×8 or 16×16. The coefficients ofthe transformed block are quantized using the determined quantizationstep size and the quantization matrix determined according to theprediction mode. The quantizer 130 uses the quantization step size of aquantization unit adjacent to a current quantization unit as aquantization step size predictor of the current quantization unit.

The quantizer 130 may generate the quantization step size predictor ofthe current quantization unit using one or two effective quantizationstep sizes resulting from sequential search of left, upper, and top-leftquantization units adjacent to the current quantization unit. Forexample, the first one of effective quantization step sizes detected bysearching the left, upper, and top-left quantization units in this ordermay be determined to be the quantization step size predictor. Inaddition, the average of the two effective quantization step sizes maybe determined to be the quantization step size predictor. If only onequantization step size is effective, it may be determined to be thequantization step size predictor. Once the quantization step sizepredictor is determined, the difference between the quantization stepsize of the current CU and the quantization step size predictor istransmitted to the entropy encoder 140.

All of the left, upper, and top-left CUs adjacent to the current CU maynot exist. However, there may be a previous CU in an LCU according to acoding order. Therefore, the quantization step sizes of the adjacentquantization units of the current CU and the quantization step size ofthe quantization unit previously encoded in the coding order within theLCU may be candidates. In this case, 1) the left quantization unit ofthe current CU, 2) the upper quantization unit of the current CU, 3) thetop-left quantization unit of the current CU, and 4) the previouslyencoded quantization unit may be prioritized in a descending order. Theorder of priority levels may be changed and the top-left quantizationunit may be omitted.

The quantized transformed block is provided to the inverse quantizer 135and the scanner 131.

The scanner 131 converts the coefficients of the quantized transformedblock to one-dimensional quantization coefficients by scanning thecoefficients of the quantized transformed block. Since the coefficientdistribution of the transformed block may be dependent on theintra-prediction mode after quantization, a scanning scheme isdetermined according to the intra-prediction mode. In addition, thecoefficient scanning scheme may vary with the size of a transform unit.A scan pattern may be different according to a directionalintra-prediction mode. The quantized coefficients are scanned in areverse order.

In the case where the quantized coefficients are divided into aplurality of subsets, the same scan pattern applies to the quantizationcoefficients of each subset. A zigzag or diagonal scan pattern appliesbetween subsets. Although scanning from a main subset including a DC tothe remaining subsets in a forward direction is preferable, scanning ina reverse direction is also possible. The inter-subset scan pattern maybe set to be identical to the intra-subset scan pattern. In this case,the inter-subset scan pattern is determined according to anintra-prediction mode. Meanwhile, the video encoder transmitsinformation indicating the position of a last non-zero quantizedcoefficient in the transform unit to a video decoder. The video encodermay also transmit information indicating the position of a last non-zeroquantized coefficient in each subset to the decoder.

The inverse quantizer 135 dequantizes the quantized coefficients. Theinverse transformer 125 reconstructs a spatial-domain residual blockfrom the inverse-quantized transformed coefficients. The adder generatesa reconstructed block by adding the residual block reconstructed by theinverse transformer 125 to a prediction block received from theintra-predictor 150 or the inter-predictor 160.

The post-processor 170 performs deblocking filtering to eliminateblocking artifact from a reconstructed picture, adaptive offsetapplication to compensate for a difference from the original picture ona pixel basis, and adaptive loop filtering to compensate for adifference from the original picture on a CU basis.

Deblocking filtering is preferably applied to the boundary between a PUand a transform unit which are of a predetermined size or larger. Thesize may be 8×8. The deblocking filtering process includes determining aboundary to be filtered, determining a boundary filtering strength toapply to the boundary, determining whether to apply a deblocking filter,and selecting a filter to apply to the boundary when determined to applythe deblocking filter.

It is determined whether to apply a deblocking filter according to i)whether the boundary filtering strength is larger than 0 and ii) whethera variation of pixels at the boundary between two blocks (a P block anda Q block) adjacent to the boundary to be filtered is smaller than afirst reference value determined based on a quantization parameter.

For the deblocking filtering, two or more filters are preferable. If theabsolute value of the difference between two pixels at the blockboundary is equal to or larger than a second reference value, a filterthat performs relatively weak filtering is selected. The secondreference value is determined by the quantization parameter and theboundary filtering strength.

Adaptive offset application is intended to reduce the difference (i.e.distortion) between pixels in a deblocking-filtered picture and originalpixels. It may be determined whether to perform the adaptive offsetapplying process on a picture basis or on a slice basis. A picture orslice may be divided into a plurality of offset areas and an offset typemay be determined per offset area. There may be a predetermined numberof (e.g. 4) edge offset types and two band offset types. In case of anedge offset type, the edge type of each pixel is determined and anoffset corresponding to the edge type is applied to the pixel. The edgetype is determined based on the distribution of two pixel valuesadjacent to a current pixel.

Adaptive loop filtering may be performed based on a comparison valuebetween an original picture and a reconstructed picture that has beensubjected to deblocking filtering or adaptive offset application.Adaptive loop filtering may apply across all pixels included in a 4×4 or8×8 block. It may be determined for each CU whether to apply adaptiveloop filtering. The size and coefficient of a loop filter may bedifferent for each CU. Information indicating whether an adaptive loopfilter is used for each CU may be included in each slice header. In caseof a chrominance signal, the determination may be made on a picturebasis. Unlike luminance, the loop filter may be rectangular.

A determination as to whether to use adaptive loop filtering may be madeon a slice basis. Therefore, information indicating whether the adaptiveloop filtering is used for a current slice is included in a slice headeror a picture header. If the information indicates that the adaptive loopfiltering is used for the current slice, the slice header or pictureheader further may incude information indicating the horizontal and/orvertical filter length of a luminance component used in the adaptiveloop filtering.

The slice header or picture header may include information indicatingthe number of filter sets. If the number of filter sets is 2 or larger,filter coefficients may be encoded in a prediction scheme. Accordingly,the slice header or picture header may include information indicatingwhether filter coefficients are encoded in a prediction scheme. If theprediction scheme is used, predicted filter coefficients are included inthe slice header or picture header.

Meanwhile, chrominance components as well as luminance components may befiltered adaptively. Therefore, information indicating whether eachchrominance component is filtered or not may be included in the sliceheader or picture header. In this case, information indicating whetherchrominance components Cr and Cb are filtered may be jointly encoded(i.e. multiplexed coding) to thereby reduce the number of bits. Bothchrominance components Cr and Cb are not filtered in many cases tothereby reduce complexity. Thus, if both chrominance components Cr andCb are not filtered, a lowest index is assigned and entropy-encoded. Ifboth chrominance components Cr and Cb are filtered, a highest index isassigned and entropy-encoded.

The picture storage 180 receives post-processed image data from thepost-processor 170, reconstructs and stores an image on a picture basis.A picture may be an image in a frame or field. The picture storage 180includes a buffer (not shown) for storing a plurality of pictures.

The inter-predictor 160 estimates a motion using at least one referencepicture stored in the picture storage 180 and determines a referencepicture index identifying the reference picture and a motion vector. Theinter-predictor 160 extracts and outputs a prediction blockcorresponding to a PU to be encoded from the reference picture used formotion estimation among the plurality of reference pictures stored inthe picture storage 180, according to the determined reference pictureindex and motion vector.

The intra-predictor 150 performs intra-prediction coding usingreconfigured pixel values of a picture including the current PU. Theintra-predictor 150 receives the current PU to be prediction-encoded,selects one of a predetermined number of intra-prediction modesaccording to the size of the current block, and performsintra-prediction in the selected intra-prediction mode. Theintra-predictor 150 adaptively filters reference pixels to generate anintra-prediction block. If the reference pixels are not available, theintra-predictor 150 may generate reference pixels using availablereference pixels.

The entropy encoder 140 entropy-encodes the quantized coefficientsreceived from the quantizer 130, intra-prediction information receivedfrom the intra-predictor 150, and motion information received from theinter-predictor 160.

FIG. 2 is a flowchart illustrating an inter-prediction coding operationaccording to an embodiment of the present invention.

The inter-prediction coding operation includes determining motioninformation of a current PU, generating a prediction block, generating aresidual block, encoding the residual block, and encoding the motioninformation. Hereinafter, a PU and a block will be used interchangeably.

(1) Determination of Motion Information of a Current PU (S110)

The motion information of the current PU includes a reference pictureindex to be referred to for the current PU and a motion vector.

To determine a prediction block of the current PU, one of one or morereconstructed reference pictures is determined to be a reference picturefor the current PU and motion information indicating the position of theprediction block in the reference picture is determined

The reference picture index for the current block may be differentaccording to the inter-prediction mode of the current block. Forexample, if the current block is in a single-directional predictionmode, the reference picture index indicates one of reference pictureslisted in List 0 (L0). On the other hand, if the current block is in abi-directional prediction mode, the motion information may includereference picture indexes indicating one of reference pictures listed inL0 and one of reference pictures listed in List 1 (L1). In addition, ifthe current block is in a bi-directional prediction mode, the motioninformation may include a reference picture index indicating one or twoof reference pictures included in a List Combination (LC) being acombination of L0 and L1.

The motion vector indicates the position of the prediction block in apicture indicated by the reference picture index. The motion vector mayhave an integer-pixel resolution or a ⅛ or 1/16 pixel resolution. If themotion vector does not have an integer-pixel resolution, the predictionblock is generated from integer pixels.

(2) Generation of a Prediction Block (S120)

If the motion vector has an integer-pixel resolution, a prediction blockof the current PU is generated by copying a corresponding block at theposition indicated by the motion vector in the picture indicated by thereference picture index.

On the other hand, if the motion vector does not have an integer-pixelresolution, the pixels of a prediction block are generated using integerpixels in the picture indicated by the reference picture index. In caseof luminance pixels, prediction pixels may be generated using an 8-tapinterpolation filter. In case of chrominance pixels, prediction pixelsmay be generated using a 4-tap interpolation filter.

(3) Generation of a Residual Block (S130) and Coding of the ResidualBlock (S140)

When prediction blocks of the current PU are generated, a residual blockis generated based on a difference between the current PU and theprediction block. The size of the residual block may be different fromthe size of the current PU. For example, if the current PU is of size2N×2N, the current PU and the residual block are of the same size.However, if the current PU is of size 2N×N or N×2N, the residual blockmay be a 2N×2N block. That is, when the current PU is a 2N×N block, theresidual block may be configured by combining two 2N×N residual blocks.In this case, to overcome the discontinuity of the boundary between two2N×N prediction blocks, a 2N×2N prediction block is generated byoverlap-smoothing boundary pixels and then a residual block is generatedusing the difference between the 2N×2N original block (two currentblocks) and the 2N×2N prediction block.

When the residual block is generated, the residual block is encoded inunits of a transform coding size. That is, the residual block issubjected to transform encoding, quantization, and entropy encoding inunits of a transform coding size. The transform coding size may bedetermined in a quad-tree scheme according to the size of the residualblock. That is, transform coding uses integer-based DCT.

The transform-encoded block is quantized using a quantization matrix.The quantized matrix is entropy-encoded by Context-Adaptive BinaryArithmetic Coding (CABAC) or Context-Adaptive Variable-Length Coding(CAVLC).

(4) Coding of the Motion Information (S150)

The motion information of the current PU is encoded using motioninformation of PUs adjacent to the current PU. The motion information ofthe current PU is subjected to merge coding or AMVP coding. Therefore,it is determined whether to encode the motion information of the currentPU by merge coding or AMVP coding and encodes the motion information ofthe current PU according to the determined coding scheme.

A description will be given below of a merge coding scheme withreference to FIG. 3.

Referring to FIG. 3, spatial merge candidates and temporal mergecandidates are derived (S210 and S220). For the convenience' sake, thespatial merge candidates are first derived and then the temporal mergecandidates are derived, by way of example. However, the presentinvention is not limited to the order of deriving the spatial andtemporal merge candidates. For example, the temporal merge candidatesfirst derived and then the spatial merge candidates may be derived, orthe spatial and temporal merge candidates may be derived in parallel.

1) Spatial Merge Candidates

Spatial merge candidates may be configured in one of the followingembodiments. Spatial merge candidate configuration information may betransmitted to the video decoder. In this case, the spatial mergecandidate configuration information may indicate one of the followingembodiments or information indicating the number of merge candidates inone of the following embodiments.

(a) Embodiment 1 Spatial Merge Candidate Configuration 1

As illustrated in FIG. 4, a plurality of spatial merge candidates may bea left PU (block A), an upper PU (block B), a top-right PU (block C),and a bottom-left PU (block D) adjacent to the current PU. In this case,all of the effective PUs may be candidates or two effective PUs may beselected as candidates by scanning the blocks A to D in the order of A,B, C and D. If there are a plurality of PUs to the left of the currentPU, an effective uppermost PU or a largest effective PU may bedetermined as the left PU adjacent to the current PU from among theplurality of left PUs. Similarly, if there are a plurality of PUs abovethe current PU, an effective leftmost PU or a largest effective PU maybe determined as the upper PU adjacent to the current PU from among theplurality of upper PUs.

(b) Embodiment 2 Spatial Merge Candidate Configuration 2

As illustrated in FIG. 5, a plurality of spatial merge candidates may betwo effective PUs selected from among a left PU (block A), an upper PU(block B), a top-right PU (block C), a bottom-left PU (block D), and atop-left PU (block E) adjacent to the current PU by scanning the blocksA to E in the order of A, B, C, D and E. Herein, the left PU may beadjacent to the block E, not to the block D. Similarly, the upper PU maybe adjacent to the block E, not to the block C.

(c) Embodiment 3 Spatial Merge Candidate Configuration 3

As illustrated in FIG. 5, the left block (the block A), the upper block(the block B), the top-right block (the block C), the bottom-left block(the block D), and the top-left block (the block E) adjacent to thecurrent PU may be candidates in this order, if they are effective. Inthis case, the block E is available if one or more of the blocks A to Dare not effective.

(d) Embodiment 4 Spatial Merge Candidate Configuration 4

As illustrated in FIG. 5, a plurality of spatial merge candidates mayinclude the left PU (the block A), the upper PU (the block B), and acorner PU (one of the blocks C, D and E) adjacent to the current PU. Thecorner PU is a first effective one of the top-right PU (the block C),bottom-left PU (the block D), and top-left PU (the block E) of thecurrent PU by scanning them in the order of C, D and E.

In the above embodiments, motion information of spatial merge candidatesabove the current PU may be set differently according to the position ofthe current PU. For example, if the current PU is at the upper boundaryof an LCU, motion information of an upper PU (block B, C or E) adjacentto the current PU may be its own motion information or motioninformation of an adjacent PU. The motion information of the upper PUmay be determined as one of its own motion information or motioninformation (a reference picture index and a motion vector) of anadjacent PU, according to the size and position of the current PU.

2) Temporal Merge Candidates

A reference picture index and a motion vector of a temporal mergecandidate are obtained in an additional process. The reference pictureindex of the temporal merge candidate may be obtained using thereference picture index of one of PUs spatially adjacent to the currentPU.

Reference picture indexes of temporal merge candidates for the currentPU may be obtained using the whole or a part of reference pictureindexes of the left PU (the block A), the upper PU (the block B), thetop-right PU (the block C), the bottom-left PU (the block D), and thetop-left PU (the block E) adjacent to the current PU. For example, thereference picture indexes of the left PU (the block A), the upper PU(the block B), and a corner block (one of the blocks C, D and E)adjacent to the current PU may be used. Additionally, the referencepicture indexes of an odd number of (e.g. 3) effective PUs may be usedfrom among the reference picture indexes of the left PU (the block A),upper PU (the block B), top-right PU (the block C), bottom-left PU (theblock D), and top-left PU (the block E) adjacent to the current PU byscanning them in the order of A, B, C, D and E.

A case where the reference picture indexes of left, upper, and cornerPUs adjacent to a current PU are used to obtain the reference indexes oftemporal merge candidates for the current PU will be described below.

The reference picture index of the left PU (hereinafter, referred to asthe left reference picture index), the reference picture index of theupper PU (hereinafter, referred to as the upper reference pictureindex), and the reference picture index of the corner PU (hereinafter,referred to as the corner reference picture index), adjacent to thecurrent PU, are obtained. While only one of the corner PUs C, D and E istaken as a candidate, to which the present invention is not limited, itmay be further contemplated in an alternative embodiment that the PUs Cand D are set as candidates (thus four candidates) or the PUs C, D and Eare all set as candidates (thus five candidates).

While three or more effective reference picture indexes are used herein,all of the effective reference picture indexes or only a referencepicture index at a predetermined position may be used. In the absence ofany effective reference picture index, reference picture index 0 may beset as the reference picture index of a temporal merge candidate.

If a plurality of reference picture indexes are used, a referencepicture index that is most frequently used from among the referencepicture indexes may be set as the reference picture index of a temporalmerge candidate. When a plurality of reference picture indexes are mostfrequently used, a reference picture index having a minimum value amongthe plurality of reference picture indexes or the reference pictureindex of a left or upper block may be set as the reference picture indexof a temporal merge candidate.

Then, an operation for obtaining a motion vector of the temporal mergecandidate will be described.

A picture including the temporal merge candidate block (hereinafter,referred to as a temporal merge candidate picture) is determined. Thetemporal merge candidate picture may be set to a picture with referencepicture index 0. In this case, if the slice type is P, the first picture(i.e. a picture with index 0) in list0 is set as a temporal mergecandidate picture. If the slice type is B, the first picture of areference picture list indicated by a flag that indicates a temporalmerge candidate list in a slice header is set as a temporal mergecandidate picture. For example, if the flag is 1, a temporal mergecandidate picture may be selected from list0 and if the flag is 0, atemporal merge candidate picture may be selected from list1.

Subsequently, a temporal merge candidate block is obtained from thetemporal merge candidate picture. One of a plurality of blockscorresponding to the current PU within the temporal merge candidatepicture may be determined as the temporal merge candidate block. In thiscase, the plurality of blocks corresponding to the current PU areprioritized and a first effective corresponding block is selected as thetemporal merge candidate block according to the priority levels.

For example, a bottom-left corner block adjacent to a blockcorresponding to the current PU within the temporal merge candidatepicture or a bottom-left block included in the block corresponding tothe current PU within the temporal merge candidate picture may be set asa first candidate block. In addition, a block including a top-left pixelor a block including a bottom-right pixel, at the center of the blockcorresponding to the current PU within the temporal merge candidatepicture may be set as a second candidate block.

If the first candidate block is effective, the first candidate block isset as the temporal merge candidate block. On the other hand, if not thefirst candidate block but the second candidate block is effective, thesecond candidate block is set as the temporal merge candidate block. Oronly the second candidate block may be used according to the position ofthe current PU. The current PU may be located in a slice or an LCU.

When the temporal merge candidate prediction block is determined, themotion vector of the temporal merge candidate prediction block is set asa temporal merge candidate motion vector.

Meanwhile, the temporal merge candidate may be adaptively off accordingto the size of the current PU. For example, if the current PU is a 4×4block, the temporal merge candidate may be off to reduce complexity.

Then a merge candidate list is generated (S230).

The merge candidate list is generated using the effective mergecandidates in a predetermined order. If a plurality of merge candidateshave the same motion information (i.e. the same motion vector and thesame reference picture index), a lower-ranked merge candidate is deletedfrom the merge candidate list.

For example, the predetermined order may be A, B, Col, C, and D inEmbodiment 1 (spatial merge candidate configuration 1). Herein, Colrepresents a temporal merge candidate.

In Embodiment 2 (spatial merge candidate configuration 2), the mergecandidate list may be generated in the order of two effective PUs andCol, the two effective PUs being determined by scanning the blocks A, B,C, D and E in this order.

In Embodiment 3 (spatial merge candidate configuration 3), thepredetermined order may be A, B, Col, C, D. If at least one of theblocks A, B, C and D is not effective, the block E may be added. In thiscase, the block E may be added at the lowest rank. In addition, themerge candidate list may be generated in the order of (one of A and D),(one of C, B and E), and Col.

In Embodiment 4 (spatial merge candidate configuration 4), thepredetermined order may be A, B, Col, Corner, or A, B, Corner, Col.

The number of merge candidates may be determined on a slice or LCUbasis. In this case, the merge candidate list is generated in apredetermined order in the above embodiments.

It is determined whether to generate merge candidates (S240). In thecase where the number of merge candidates is set to a fixed value, ifthe number of effective merge candidates is smaller than the fixedvalue, merge candidates are generated (S250). The generated mergecandidates are added to the merge candidate list. In this case, thegenerated merge candidates are added below the lowest ranked mergecandidate in the merge candidate list. If a plurality of mergecandidates are added, they are added in a predetermined order.

The added merge candidate may be a candidate with motion vector 0 andreference picture index 0 (a first added merge candidate). In addition,the added merge candidate may be a candidate generated by combining themotion information of effective merge candidates (a second added mergecandidate). For example, a candidate may be generated by combining themotion information (the reference picture index) of a temporal mergecandidate with the motion information (motion vector) of an effectivespatial merge candidate and then added to the merge candidate list.Merge candidates may be added in the order of the first and second addedmerge candidates or in the reverse order.

On the contrary, if the number of merge candidates is variable and onlyeffective merge candidates are used, the steps S240 and S250 may beomitted.

A merge candidate is determined as a merge predictor of the current PU,from the generated merge candidate list (S260).

Then the index of the merge predictor (i.e. the merge index) is encoded(S270). In case of a single merge candidate, the merge index is omitted.On the other hand, in case of two or more merge candidates, the mergeindex is encoded.

The merge index may be encoded by fixed-length coding or CAVLC. If CAVLCis adopted, the merge index for codeword mapping may be adjustedaccording to a PU shape and a PU index.

The number of merge candidates may be variable. In this case, a codewordcorresponding to the merge index is selected using a table that isdetermined according to the number of effective merge candidates.

The number of merge candidates may be fixed. In this case, a codewordcorresponding to the merge index is selected using a single tablecorresponding to the number of merge candidates.

With reference to FIG. 6, an AMVP coding scheme will be described.

Referring to FIG. 6, a spatial AMVP candidate and a temporal AMVPcandidate are derived (S310 and S320).

1) Spatial AMVP candidates

(a) Spatial AMVP Candidate Configuration 1

As illustrated in FIG. 5, spatial AMVP candidates may include one (aleft candidate) of the left PU (the block A) and bottom-left PU (theblock D) adjacent to the current PU and one (an upper candidate) of theright PU (the block B), top-right PU (the block C), and top-left PU (theblock E) adjacent to the current PU. The motion vector of a firsteffective PU is selected as the left or upper candidate by scanning PUsin a predetermined order. The left PUs may be scanned in the order of Aand D or in the order of D and A. The upper PUs may be scanned in theorder of B, C and E or in the order of C, B and E.

(b) Spatial AMVP Candidate Configuration 2

As illustrated in FIG. 4, the spatial AMVP candidates may be twoeffective PUs selected from the left PU (the block A), upper PU (theblock B), top-right PU (the block C), and bottom-left PU (the block D)adjacent to the current PU by scanning them in the order of A, B, C andD. In this case, all of effective PUs may be candidates or two effectivePUs obtained by scanning the blocks A, B, C and D in this order may becandidates. If there are a plurality of PUs to the left of the currentPU, an effective uppermost PU or an effective PU having a largest areamay be set as the left PU. Similarly, if there are a plurality of PUsabove the current PU, an effective leftmost PU or an effective PU havinga largest area may be set as the upper PU.

(c) Spatial AMVP Candidate Configuration 3

As illustrated in FIG. 5, spatial AMVP candidates may include twoeffective PUs obtained by scanning the left PU (the block A), right PU(the block B), top-right PU (the block C), bottom-left PU (the block D),and top-left PU (the block E) adjacent to the current PU in this order.The left PU may be adjacent to the block E, not to the block D.Likewise, the upper PU may be adjacent to the block E, not to the blockC.

(d) Spatial AMVP Candidate Configuration 4

As illustrated in FIG. 5, spatial AMVP candidates may be four blocksselected from among the left PU (the block A), upper PU (the block B),top-right PU (the block C), bottom-left PU (the block D), and top-leftPU (the block E) adjacent to the current PU. In this case, the block Emay be available when one or more of blocks A to D are not effective.

(e) Spatial AMVP Candidate Configuration 5

As illustrated in FIG. 5, spatial AMVP candidates may include the leftPU (the block A), upper PU (the block B), and a corner PU (one of theblocks C, D and E) adjacent to the current PU. The corner PU is a firsteffective one of the top-right PU (the block C), bottom-left PU (theblock D), and top-left PU (block E) of the current PU by scanning themin the order of C, D and E.

In the above embodiments, motion information of AMVP candidates abovethe current PU may be set differently according to the position of thecurrent PU. For example, if the current PU is at the upper boundary ofan LCU, the motion vector of an upper PU (the block B, C or E) adjacentto the current PU may be its own motion vector or the motion vector ofan adjacent PU. The motion vector of the upper PU may be determined asits own motion vector or the motion vector of an adjacent PU accordingto the size and position of the current PU.

2) Temporal AMVP Candidate

Because a temporal AMVP candidate needs only motion information, thereis no need for obtaining a reference picture index, compared to a mergecandidate. An operation for obtaining the motion vector of a temporalAMVP candidate will first be described.

A picture including the temporal AMVP candidate block (hereinafter,referred to as a temporal AMVP candidate picture) is determined. Thetemporal AMVP candidate picture may be set to a picture with referencepicture index 0. In this case, if the slice type is P, the first picture(i.e. a picture with index 0) in list0 is set as a temporal AMVPcandidate picture. If the slice type is B, the first picture of areference picture list indicated by a flag that indicates a temporalAVMP candidate list in a slice header is set as a temporal AVMPcandidate picture.

Then, a temporal AMVP candidate block is obtained from the temporal AMVPcandidate picture. This is performed in the same manner as the operationfor obtaining a temporal merge candidate block and thus its descriptionwill not be provided herein.

Meanwhile, the temporal AMVP candidate may be adaptively off accordingto the size of the current PU. For example, if the current PU is a 4×4block, the temporal AMVP candidate may be off to reduce complexity.

Then an AMVP candidate list is generated (S330).

The AMVP candidate list is generated using effective AMVP candidates ina predetermined order. If a plurality of AMVP candidates have the samemotion information (i.e. it is not necessary that the reference picturesare identical), lower-ranked AMVP candidates are deleted from the AMVPcandidate list.

In spatial AMVP candidate configuration 1, the predetermined order isone of A and D (the order of A and D or the order of D and A), one of B,C and E (the order of B, C and E or the order of C, B and E), and Col,or Col, one of A and D, and one of B, C and E. Herein, Col represents atemporal AMVP candidate.

In spatial AMVP candidate configuration 2, the predetermined order is A,B, Col, C, D or C, D, Col, A, B.

In spatial AMVP candidate configuration 3, the predetermined order is(two effective ones of A, B, C, D and E in this order) and Col or Coland (two effective ones of A, B, C, D and E in this order).

In spatial AMVP candidate configuration 4, the predetermined order is A,B, Col, C, and D. If at least one of the blocks A, B, C and D is noteffective, the block E may be added at the lowest rank.

In spatial AMVP candidate configuration 5, the predetermined order is A,B, Col, and corner.

It is determined whether to generate AMVP candidates (S340). In the casewhere the number of AMVP candidates is set to a fixed value, if thenumber of effective AMVP candidates is smaller than the fixed value,AMVP candidates are generated (S350). The fixed value may be 2 or 3. Thegenerated AMVP candidates are added below the lowest-ranked AMVPcandidate in the AMVP candidate list. The added AMVP candidate may be acandidate with motion vector 0.

On the contrary, if the number of AMVP candidates is variable and onlyeffective AMVP candidates are used, the steps S340 and S350 may beomitted.

A motion vector predictor of the current PU is selected from the AMVPcandidate list (S360). An AMVP index indicating the predictor isgenerated.

Then, a differential motion vector between the motion vector of thecurrent PU and the motion vector predictor is generated (S370).

The reference picture index of the current PU, the differential motionvector, and the AMVP index are encoded (S380). In case of a single AMVPcandidate, the AMVP index may be omitted.

The AMVP index may be encoded by fixed-length coding or CAVLC. If CAVLCis adopted, the AMVP index for codeword mapping may be adjustedaccording to a PU shape and a PU index.

The number of AMVP candidates may be variable. In this case, a codewordcorresponding to the AMVP index is selected using a table determinedaccording to the number of effective AMVP candidates.

Meanwhile, the merge candidate block may be identical to the AMVPcandidate block. For example, in the case where the AMVP candidateconfiguration is identical to the merge candidate configuration. Thus,encoder complexity can be reduced.

FIG. 7 is a block diagram of a video decoder according to an embodimentof the present invention.

Referring to FIG. 7, the video decoder of the present invention includesan entropy decoder 210, an inverse quantizer/inverse transformer 220, anadder 270, a deblocking filter 250, a picture storage 260, anintra-predictor 230, a motion compensation predictor 240, and anintra/inter switch 280.

The entropy decoder 210 separates an intra-prediction mode index, motioninformation, and a quantized coefficient sequence from a coded bitstream received from the video encoder by decoding the coded bit stream.The entropy decoder 210 provides the decoded motion information to themotion compensation predictor 240, the intra-prediction mode index tothe intra-predictor 230 and the inverse quantizer/inverse transformer220, and the quantized coefficient sequence to the inversequantizer/inverse transformer 220.

The inverse quantizer/inverse transformer 220 converts the quantizedcoefficient sequence to a two-dimensional array of dequantizedcoefficients. For the conversion, one of a plurality of scan patterns isselected based on at least one of the prediction mode (i.e. one ofintra-prediction and inter-prediction) and intra-prediction mode of thecurrent block. The intra-prediction mode is received from theintra-predictor 230 or the entropy decoder 210.

The inverse quantizer/inverse transformer 220 reconstructs quantizedcoefficients from the two-dimensional array of dequantized coefficientsusing a quantization matrix selected from among a plurality ofquantization matrices. Even for blocks having the same size, the inversequantizer/inverse transformer 220 selects a quantization matrix based onat least one of the prediction mode and intra-prediction mode of acurrent block. Then a residual block is reconstructed by inverselytransforming the reconstructed quantized coefficients.

The adder 270 adds the reconstructed residual block received from theinverse quantizer/inverse transformer 220 to a prediction blockgenerated from the intra-predictor 230 or the motion compensationpredictor 240, thereby reconstructing an image block.

The deblocking filter 250 performs a deblocking filtering for thereconstructed image generated by the adder 270. Thus, deblockingartifact caused by image loss during quantization may be reduced.

The picture storage 260 includes a frame memory that preserves a localdecoded image that has been deblocking-filtered by the deblocking filter250.

The intra-predictor 230 determines the intra-prediction mode of thecurrent block based on the intra-prediction mode index received from theentropy decoder 210 and generates a prediction block according to thedetermined intra-prediction mode.

The motion compensation predictor 240 generates a prediction block ofthe current block from a picture stored in the picture storage 260 basedon the motion vector information. If motion compensation withfractional-pel accuracy is applied, the prediction block is generatedusing a selected interpolation filter.

The intra/inter switch 280 provides one of the prediction blockgenerated from the intra-predictor 230 and the prediction blockgenerated from the motion compensation predictor 240 to the adder 270.

FIG. 8 is a flowchart illustrating an inter-prediction decodingoperation according to an embodiment of the present invention.

Referring to FIG. 8, the video decoder may check whether a current PU tobe decoded has been encoded in SKIP mode (S405). The check may be madebased on skip_flag of a CU.

If the current PU has been encoded in SKIP mode, the motion informationof the current PU is decoded according to a Smotion information decodingprocess corresponding to the SKIP mode (S410). The motion informationdecoding process corresponding to the SKIP mode is the same as a motioninformation decoding process corresponding to a merge mode.

A corresponding block within a reference picture, indicated by thedecoded motion information of the current PU is copied, therebygenerating a reconstructed block of the current PU (S415).

On the other hand, if the current PU has not been encoded in the SKIPmode, it is determined whether the motion information of the current PUhas been encoded in merge mode (S420).

If the motion information of the current PU has been encoded in themerge mode, the motion information of the current PU is decoded in themotion information decoding process corresponding to the merge mode(S425).

A prediction block is generated using the decoded motion information ofthe current PU (S430).

If the motion information of the current PU has been encoded in themerge mode, a residual block is decoded (S435).

Then, a reconstructed block of the current PU is generated using theprediction block and the residual block (S440).

On the other hand, if the motion information of the current PU has notbeen encoded in the merge mode, the motion information of the current PUis decoded in a motion information decoding process corresponding to anAMVP mode (S445).

Then, a prediction block is generated using the decoded motioninformation of the current PU (S450) and the residual block is decoded(S455). A reconstructed block is generated using the prediction blockand the residual block (S460).

The motion information decoding process is different depending on thecoding pattern of the motion information of the current PU. The codingpattern of the motion information of the current PU may be one of mergemode and AMVP mode. In SKIP mode, the same motion information decodingprocess as in the merge mode is performed.

First, a description will be given of a motion information decodingoperation, when the coding pattern of the motion information of acurrent PU is the merge mode.

FIG. 9 is a flowchart illustrating a motion vector decoding operation,when the number of merge candidates is variable.

Referring to FIG. 9, it is determined whether there is any mergecodeword (S510).

In the absence of a merge codeword, an effective merge candidate issearched, determining that there is a single merge candidate for thecurrent PU (S520). Merge candidate configurations and merge candidatesearch orders (i.e. listing orders) have been described before withreference to FIG. 3.

Upon a search of an effective merge candidate, the motion information ofthe current PU is generated using the motion information of the mergecandidate (S530). That is, the reference picture index and motion vectorof the merge candidate are set as the reference picture index and motionvector of the current PU.

In the present of a merge codeword, effective merge candidates aresearched and a merge candidate list is comprised of the effective mergecandidates (S540). Methods for configuring merge candidate andgenerating a merge candidate list have been described before withreference to FIG. 3.

A VLC table corresponding to the number of merge candidates is selected(S550).

A merge index corresponding to the merge codeword is reconstructed(S560).

A merge candidate corresponding to the merge index is selected from themerge candidate list and the motion information of the merge candidateis set as the motion information of the current PU (S570).

FIG. 10 is a flowchart illustrating a motion vector decoding operation,when the number of merge candidates is fixed. The number of mergecandidates may be fixed on a picture or slice basis.

Referring to FIG. 10, effective merge candidates are searched (S610).Merge candidates include a spatial merge candidate and a temporal mergecandidate. The positions of spatial merge candidates, the method forderiving the spatial merge candidates, the positions of temporal mergecandidates and the method for deriving he temporal merge candidates havebeen described before with reference to FIG. 3. If the current PU issmaller than a predetermined size, the temporal merge candidate may notbe used. For example, the merge candidate may be omitted for a 4×4 PU.

Upon a search of effective merge candidates, it is determined whether togenerate a merge candidate (S620). If the number of effective mergecandidates is smaller than a predetermined value, a merge candidate isgenerated (S630). The merge candidate may be generated by combining themotion information of effective merge candidates. A merge candidate withmotion vector 0 and reference picture index 0 may be added. Mergecandidates are added in a predetermined order.

A merge list is made using the merge candidates (S640). This step may beperformed in combination with the steps S620 and S630. The mergecandidate configurations and the merge candidate search orders (i.e.listing orders) have been described before with reference to FIG. 3.

A merge index corresponding to a merge codeword in a received bit streamis reconstructed (S650). Since the number of merge candidates is fixed,the merge index corresponding to the merge codeword may be obtained fromone decoding table corresponding to the number of merge candidates.However, a different decoding table may be used depending on whether atemporal merge candidate is used.

A candidate corresponding to the merge index is searched from the mergelist (S660). The searched merge candidate is determined to be a mergepredictor.

Once the merge predictor is determined, the motion information of thecurrent PU is generated using the motion information of the mergepredictor (S670). Specifically, the motion information of the mergepredictor, i.e. the reference picture index and motion vector of themerge predictor are determined to be the reference picture index andmotion vector of the current PU.

Now a description will be given of a motion information decodingoperation, when the motion information coding pattern of a current PU isAMVP.

FIG. 11 is a flowchart illustrating a motion vector decoding operation,when the number of AMVP candidates is variable.

Referring to FIG. 11, the reference picture index and differentialmotion vector of a current PU are parsed (S710).

It is determined whether there exists an AMVP codeword (S720).

In the absence of an AMVP codeword, an effective AMVP candidate issearched, determining that the number of AMVP candidates for the currentPU is 1 (S730). The AMVP candidate configurations and the AMVP candidatesearch orders (i.e. listing orders) have been described before in detailwith reference to FIG. 6.

Upon a search of an effective AMVP candidate, the motion vector of theAMVP candidate is set as a motion vector predictor of the current PU(S740).

In the presence of an AMVP codeword, an AMVP candidate list is generatedby searching effective AMVP candidates (S750). The AMVP candidateconfigurations and the AMVP candidate search orders (i.e. listingorders) have been described before in detail with reference to FIG. 6.

A VLC table corresponding to the number of AMVP candidates is selected(S760).

An AMVP index corresponding to the AMVP codeword is reconstructed(S770).

An AMVP candidate corresponding to the AMVP index is selected from theAMVP candidate list and the motion vector of the AMVO candidate is setas a motion vector predictor of the current PU (S780).

The sum of the motion vector predictor obtained in the step S740 or S780and the differential motion vector obtained in the step S710 is set as afinal motion vector of the current block (S790).

FIG. 12 is a flowchart illustrating a motion vector decoding operation,when the number of AMVP candidates is fixed.

Referring to FIG. 12, the reference picture index and differentialmotion vector of a current PU are parsed (S810).

Effective AMVP candidates are searched (S820). AMVP candidates include aspatial AMVP candidate and a temporal AMVP candidate. The positions ofspatial AMVP candidates, the method for deriving the spatial AMVPcandidates, the positions of temporal AMVP candidates, and the methodfor deriving the temporal AMVP candidates have been described beforewith reference to FIG. 6. If the current PU is smaller than apredetermined size, the temporal AMVP candidate may not be used. Forexample, the AMVP candidate may be omitted for a 4×4 PU.

It is determined based on the number of effective AMVP candidateswhether to generate an AMVP candidate (S830). If the number of effectiveAMVP candidates is smaller than a predetermined value, an AMVP candidateis generated (S840). The predetermined value may be 2 or 3.

For example, in the case where there exists a spatial upper AMVPcandidate, not a spatial left AMVP candidate, if an effective PU otherthan the spatial upper AMVP candidate exists, the motion vector of theeffective PU may be added. On the contrary, in the case where thereexists a spatial left AMVP candidate, not a spatial upper AMVPcandidate, if an effective PU other than the spatial left AMVP candidateexists, the motion vector of the effective PU may be added. Or an AMVPcandidate with motion vector 0 may be added.

An AMVP candidate list is generated using the effective AMVP candidatesand/or the generated AMVP candidate (S850). The step S850 may beperformed after the step S820. In this case, the step S850 follows thestep S840. How to generate a candidate list has been described beforewith reference to FIG. 6.

An AMVP index corresponding to an AMVP codeword is recovered (S860). TheAMVP index may be encoded by fixed length coding.

Then, an AMVP candidate corresponding to the AMVP index is searched fromthe AMVP candidate list (S870). The searched AMVP candidate isdetermined to be an AMVP predictor.

The motion vector of the AMVP predictor is determined to be the motionvector of the current PU (S880).

The sum of the differential motion vector obtained in the step S810 andthe motion vector predictor obtained in the step S880 is set as a finalmotion vector of the current PU and the reference picture index obtainedin the step S810 is set as the reference picture index of the current PU(S880).

It will be apparent to those skilled in the art that variousmodifications and variations can be made in the present inventionwithout departing from the spirit or scope of the invention. Thus, it isintended that the present invention cover the modifications andvariations of this invention provided they come within the scope of theappended claims and their equivalents.

1. A method of encoding an image in a merge mode, the method comprising:determining motion information of a current prediction unit, andgenerating a prediction block using the motion information; generating aresidual block using an original block and the prediction block,transforming the residual block to generate a transformed block,quantizing the transformed block using a quantization parameter togenerated a quantized block, and scanning the quantized block toentropy-code the quantized block; and encoding the motion informationusing effective spatial and temporal merge candidates of the currentprediction unit, wherein a motion vector of the temporal merge candidateis a motion vector of a temporal merge candidate block within a temporalmerge candidate picture, and the quantization parameter is encoded usingan average of two effective quantization parameter among a leftquantization parameter, an upper quantization parameter and a previousquantization parameter of a current coding unit.
 2. The method of claim1, wherein, when the quantized block is larger than a predeterminedsize, the quantized block is divided into a plurality of subblocks to bescanned, and a scan pattern for scanning the plurality of subblocks isthe same as a scan pattern for scanning quantized coefficients withineach subblock.
 3. The method of claim 2, wherein the plurality ofsubblocks and the quantized coefficients are scanned in a reversedirection.
 4. The method of claim 1, wherein the temporal mergecandidate picture is determined according to a slice type.
 5. The methodof claim 4, wherein the temporal merge candidate block is a firsteffective block when a first candidate block and a second candidateblock are retrieved in this order.
 6. The method of claim 5, wherein thefirst candidate block is a bottom-left block adjacent to a blockcorresponding to the current prediction unit within the temporal mergecandidate picture, and the second candidate block is a block including aupper-left pixel of a center of the block corresponding to the currentprediction unit within the temporal merge candidate picture.
 7. Themethod of claim 1, wherein, if only one of the left quantizationparameter, the upper quantization parameter and the previousquantization parameter is effective, the quantization parameter of thecurrent coding unit is encoded using the effective quantizationparameter.